package com.jar.exercise.io.对象序列化;

import java.io.*;

/**
 * 对象序列化
 */
public class Demo {
	public static void main(String[] args) throws Exception {
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("D:\\Study\\IDEA\\vue\\Demo\\src\\io\\对象序列化\\obj.txt"));
		oos.writeObject(new Student("张三", 18));
		oos.close();
		ObjectInputStream ois = new ObjectInputStream(new FileInputStream("D:\\Study\\IDEA\\vue\\Demo\\src\\io\\对象序列化\\obj.txt"));
		Student student = (Student) ois.readObject();
		ois.close();
		System.out.println(student);
	}
}
